package com.wcfsy.wechat.wx.um.controller;

import java.beans.PropertyEditorSupport;

import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.util.HtmlUtils;

public abstract class AbstractXssDefenderController {
	@InitBinder
	protected void initBinderString(WebDataBinder binder) {
		binder.registerCustomEditor(String.class, new PropertyEditorSupport() {
			public void setAsText(String text) throws IllegalArgumentException {
				setValue(HtmlUtils.htmlEscape(text));
			}
		});
	}
}
